<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/3/8
 * Time: 11:57
 */

echo "<title>6-5 条件结构之switch…case…  </title>";
echo "<p style='text-align: center'><a href=\"index.php\"><font size=\"4\">目录</font></a></p>";
header("Content-type: text/html; charset=utf-8");
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";

$num = mt_rand(1,50); //获取1至50的随机数
$info = "";//提示信息
switch($num){
    case 1:
        $info = "恭喜你！中了一等奖！";
        break;
    case 2:
        $info = "恭喜你！中了二等奖！";
        break;
    case 3:
        $info = "恭喜你！中了三等奖！";
        break;
    default:
        $info = "很遗憾！你没有中奖！";
}
    echo $info;//输出是否中奖
